package com.jk.smartelderlycare.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.smartelderlycare.dto.SysProcurement;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.HashMap;

public interface SysProcurementMapper extends BaseMapper<SysProcurement> {
    /**
     * @description: 后端分页查询
     * @param: [sysProcurement, page]
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.jk.smartelderlycare.dto.SysProcurement>
     * @author hhk
     * @date: 2024/12/5 10:00
     */

    IPage<SysProcurement> findSysProcurementPaginationList(@Param(value = "sysProcurement") SysProcurement sysProcurement, Page<SysProcurement> page);
    /** 
     * @description: 新增中间表 供应商
     * @param: [map]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 17:09
     */ 
    void addSysProcurementAndSupplier(HashMap<Object, Object> map);
    /**
     * @description: 删除
     * @param: [documentId]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 17:12
     */
    @Delete("delete from sys_procurement_supplier where document_id =#{documentId}")
    void deleteSysUserRoleByUserId(Long documentId);
    /**
     * @description: 审核
     * @param: [documentId]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 17:14
     */
    @Update("update sys_procurement set state = '审核' where document_id = #{documentId}")
    void upStatusById(Long documentId);
    /**
     * @description: 未审核
     * @param: [documentId]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 17:16
     */
    @Update("update sys_procurement set state = '未审核' where document_id = #{documentId}")
    void downStatusById(Long documentId);
    /**
     * @description: 关闭
     * @param: [documentId]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:40
     */
    @Update("update sys_procurement set  state = '已关闭' where document_id = #{documentId}")
    void ShutdownStatusById(Long documentId);
}